package com.my.app.tools.pojo.em.client;

import com.my.app.tools.core.service.common.AppConfigService;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.ocr.v20181119.OcrClient;

public enum OcrClientTencent {
    //
    INSTANCE(),
    ;
    private OcrClient client;

    private OcrClientTencent() {
        initClient();
    }

    public void initClient() {
        String appId = AppConfigService.readStringConfig("/app-config/ocr-api/tencent/api-id");
        String secretId = AppConfigService.readStringConfig("/app-config/ocr-api/tencent/secret-id");
        String secretKey = AppConfigService.readStringConfig("/app-config/ocr-api/tencent/secret-key");
        String region = AppConfigService.readStringConfig("/app-config/ocr-api/tencent/region");
        Credential cred = new Credential(secretId, secretKey);
        client = new OcrClient(cred, region);
    }

    public OcrClient getClient() {
        return client;
    }
}
